package org.fizz.timertask;

import org.fizz.handlerequest.LinuxLocalConfigIml;
import org.fizz.network.CumtNetWorkClient;
import org.fizz.network.CumtNetWorkClientImp;
import org.fizz.network.NoSuchOperatorName;
import org.fizz.network.OperatorName;
import sun.nio.ch.ThreadPool;

import java.net.SocketException;
import java.util.Iterator;
import java.util.Map;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

import static org.fizz.handlerequest.ConfigKeyConstant.ipV4Name;
import static org.fizz.handlerequest.ConfigKeyConstant.macName;

/**
 * @Author Fizz Pu
 * @Date 2021/5/3 下午1:32
 * @Version 1.0
 * 失之毫厘，缪之千里！
 */

public class Main {
    public static void main(String[] args) throws SocketException, NoSuchOperatorName {
        LinuxLocalConfigIml linuxLocalConfigIml = new LinuxLocalConfigIml();

        String userName = "16184876";
        String passWord = "147934";
        OperatorName operatorName = OperatorName.Unicom;
        CumtNetWorkClientImp cumtNetWorkClientImp = new CumtNetWorkClientImp(userName, passWord, operatorName);

        for (Map<String, String> map : (Iterable<Map<String, String>>) linuxLocalConfigIml) {
            String ipV4 = map.get(ipV4Name);
            String mac = map.get(macName);
            cumtNetWorkClientImp.setIpV4(ipV4);
            cumtNetWorkClientImp.setMacAddress(mac);
            if (cumtNetWorkClientImp.login()) {
                System.out.println("登录成功");
                return;
            }
        }

        System.out.println("未找到网络");
    }
}
